<?php
class Admin_Model_Admins extends Zend_Db_Table_Abstract{
    protected $_name = 'tbladmin';
    public function getAllAdmin(){
        $sql = $this->_db->select()
                         ->from($this->_name)
                         ->where('1=1')
                         ->order('adm_id desc');
                                
        return $this->_db->fetchAll($sql);
    }
    public function getAdmin($id){
        $sql = $this->_db->select()
                         ->from($this->_name)
                         ->where('adm_id='.$id);
        return $this->_db->fetchRow($sql);                         
    }
    
    public function addAdmin($username,$password,$fullname,$email){
        $arrdata = array(
            'adm_usrname' => $username,
            'adm_usrpwd'  => md5($password),
            'adm_fullname'=> $fullname,
            'adm_email'   => $email
        );
        return $this->insert($arrdata);
    }
    public function editAdmin($username,$password,$fullname,$email,$cond){
        
        $arrdata = array(
            'adm_usrname' => $username,
            'adm_usrpwd'  => md5($password),
            'adm_fullname'=> $fullname,
            'adm_email'   => $email
        );
        return $this->update($arrdata,'adm_id='.$cond);
    }
	 
	public function deleteAdmin($id){
	}
}